import { createGetRequest, createPostRequest } from '@/utils/request'
// 添加药品
const addMedicine = async (values) => {
    return await createPostRequest('/medicine/add', values)
}

// 获取药品信息
const getMedicineInfo = async (params) => {
    return await createGetRequest('/medicine/info', params)
}

// 获取药品列表  
const getMedicineList = async (params) => {
    return await createGetRequest('/medicine/list', params)
}

// 删除药品
const deleteMedicineOne = async (id) => {
    return await createPostRequest('/medicine/deleteOne', { id })
}
// 删除药品
const deleteMedicineAll = async (name) => {
    return await createPostRequest('/medicine/deleteAll', { name })
}

// 单一药品出库
const medicineOut = async (data) => {
    return await createPostRequest('/medicine/out', data)
}

// 药品入库
const medicineIn = async (values) => {
    return await createPostRequest('/medicine/in', values)
}

// 药品出入库历史记录
const medicineHistory = async (params) => {
    return await createGetRequest('/medicine/history', params)
}

// 药品过期提醒
const medicineRemind = async () => {
    return await createGetRequest('/medicine/deadlineRemind')
}


// 药品联动查询
const medicineSearch = async (values) => {
    return await createPostRequest('/medicine/search', values)
}

// 药品结存导出
const medicineRestExport = async (values) => {
    return await createGetRequest('/medicine/export', values, { responseType: 'blob' })
}

// 今日入库导出
const medicineImportExport = async () => {
    return await createGetRequest('/medicine/exportHistory', {}, { responseType: 'blob' })
}

export {
    addMedicine,
    getMedicineInfo,
    getMedicineList,
    deleteMedicineOne,
    deleteMedicineAll,
    medicineSearch,
    medicineOut,
    medicineIn,
    medicineHistory,
    medicineRemind,
    medicineRestExport,
    medicineImportExport
}